﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Honeycomb
{
    public partial class Form1 : Form
    {
        private Queen _queen;

        public Form1()
        {
            InitializeComponent();

            var workers = new Worker[4];
            workers[0] = new Worker(new[] { "Nectar collector", "Honey manufacturing" }, 175);
            workers[1] = new Worker(new[] { "Egg care", "Baby bee tutoring" }, 114);
            workers[2] = new Worker(new[] { "Hive maintenance", "String patrol" }, 149);
            workers[3] = new Worker(new[] { "Nectar collector", "Honey manufacturing", "Egg care", "Baby bee tutoring", "Hive maintenance", "Sting patrol" }, 155);
            _queen = new Queen(workers, 275);
        }

        private void BtnAssignJob_Click(object sender, EventArgs e)
        {
            if (_queen.AssignWork(CboWorkerBeeJob.Text, (int)NudShifts.Value) == false)
            {
                MessageBox.Show(
                    @"No workers are avilable to do the job '" + CboWorkerBeeJob.Text + @"'",
                    @"The queen bee says...");
            }
            else
            {
                MessageBox.Show(
                    @"The job '" + CboWorkerBeeJob.Text + @"' will be done in " + NudShifts.Value + @" shifts",
                    @"The queen bee says...");
            }
        }

        private void BtnNextShift_Click(object sender, EventArgs e)
        {
            TxtReport.Text = _queen.WorkTheNextShift();
        }
    }
}
